package com.dragon.test.dao.impl;

import java.util.List;
import org.springframework.orm.hibernate5.HibernateTemplate;
import com.dragon.test.dao.ICustomerDao;
import com.dragon.test.domain.Customer;

public class CustomerDaoImpl implements ICustomerDao {

	HibernateTemplate hibernateTemplate;

	public HibernateTemplate getHibernateTemplate() {
		return hibernateTemplate;
	}

	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

	@Override
	public List<Customer> findAllCustomer() {
		System.out.println("findAllCustomer...");
		return (List<Customer>) hibernateTemplate.find("from Customer");
	}

	@Override
	public void saveCustomer(Customer customer) {
		System.out.println("saveCustomer...");
		hibernateTemplate.save(customer);
	}

	@Override
	public void deleteCustomer(Customer customer) {
		System.out.println("deleteCustomer...");
		hibernateTemplate.delete(customer);
	}

}
